<template>
  <a-card :bordered="false">
    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange"
      >
        <span slot="actionName">
          <a-button size="small" @click="handleAdd" type="primary" icon="plus">新增</a-button>
        </span>
        <span slot="category" slot-scope="text, record">
          {{ record.category == '1' ? '内部人员' : '外部人员' }}
        </span>
        <span slot="action" slot-scope="text, record">
          <a @click="handleCheck(record, '方案管理-查看')">查看</a>
          <a-divider type="vertical" />
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a @click="handleEdit(record, '方案管理-编辑')">编辑</a>
              </a-menu-item>
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
      </a-table>
    </div>
    <!-- 表单区域 -->
    <sysDepart-modal ref="sysDepartModal" @ok="modalFormOk"></sysDepart-modal>
  </a-card>
</template>

<script>
import SysDepartModal from './modules/ProgrammeModal'
// 表头
const columns = [
  {
    title: '方案名称',
    dataIndex: 'departName',
  },
  {
    title: '类别',
    dataIndex: 'orgType',
  },
  {
    title: '子类别',
    dataIndex: 'orgCode',
  },
  {
    dataIndex: 'action',
    align: 'center',
    slots: { title: 'actionName' },
    scopedSlots: { customRender: 'action' },
  },
]
export default {
  name: 'ProgrammeList',
  components: {
      SysDepartModal
    },
  data() {
    return {
      columns: columns,
    }
  },
  methods: {
    handleAdd() {
      this.$refs.sysDepartModal.add()
      this.$refs.sysDepartModal.title = '方案管理-新增'
    },
  },
}
</script>

<style>
</style>